<?php
namespace frontend\controllers;

use Yii;
use frontend\models\Tags;

class PublicController extends \common\controllers\CommonController
{
    
    public $enableCsrfValidation;


    public function __construct($id, $module, $config = array()) {
        parent::__construct($id, $module, $config);
        $this->enableCsrfValidation = false;
        Yii::$app->params['menus'] = $this->getMenus();
        $this->getView()->title = "小说";
    }
    
    private function getMenus(){
        $tags = Tags::getAll('tagId, tagName');
        $menus = [];
        foreach((array)$tags as $k => $tag){
            $menus[] = ['label' => $tag['tagName'], 'url' => ['type/index', 'id' => $tag['tagId']]];
        }
        return $menus;
    }
}
